package de.haw.adt.implementation;

import static de.haw.adt.implementation.Values.KILO;
import de.haw.adt.interfaces.IForce;

class Force extends AbstractPhysicalScalar implements IForce {

	private final double force;

	private Force(double force) {
		this.force = force;
	}
	
	@Override
	double getValue() {
		return force;
	}

	public int compareTo(IForce force) {
		return Double.compare(this.force, force.getN());
	}

	@Override
	public boolean equals(Object o) {
		if (o == this)
			return true;
		if (!(o instanceof IForce))
			return false;
		return this.compareTo((IForce) o) == 0;
	}

	public double getN() {
		return force;
	}

	public double getKN() {
		return force / KILO;
	}

	public IForce add(IForce force) {
		return valueOf(this.force + force.getN());
	}

	public IForce sub(IForce force) {
		return valueOf(this.force - force.getN());
	}
	
	public static IForce valueOf(double force) {
		return new Force(force);
	}
}
